package cn.wingware.util;

import java.util.Date;

public class JsonErrorInfo {
	private String code;
	private Date timestamp;
	private String message;
	private String detail;
	private String source;
	private String URL;

	/**
	 * Get the 'Code' element value. 错误码
	 * 
	 * @return value
	 */
	public String getCode() {
		return code;
	}

	/**
	 * Set the 'Code' element value. 错误码
	 * 
	 * @param code
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * Get the 'Timestamp' element value.
	 * 
	 * @return value
	 */
	public Date getTimestamp() {
		return timestamp;
	}

	/**
	 * Set the 'Timestamp' element value.
	 * 
	 * @param timestamp
	 */
	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}

	/**
	 * Get the 'Message' element value. 可显示的错误信息
	 * 
	 * @return value
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * Set the 'Message' element value. 可显示的错误信息
	 * 
	 * @param message
	 */
	public void setMessage(String message) {
		this.message = message;
	}

	/**
	 * Get the 'Detail' element value. 错误详细信息
	 * 
	 * @return value
	 */
	public String getDetail() {
		return detail;
	}

	/**
	 * Set the 'Detail' element value. 错误详细信息
	 * 
	 * @param detail
	 */
	public void setDetail(String detail) {
		this.detail = detail;
	}

	/**
	 * Get the 'Source' element value. 错误源
	 * 
	 * @return value
	 */
	public String getSource() {
		return source;
	}

	/**
	 * Set the 'Source' element value. 错误源
	 * 
	 * @param source
	 */
	public void setSource(String source) {
		this.source = source;
	}

	/**
	 * Get the 'URL' element value. 错误描述相关URL（在某些情景下，可以将错误描述发布成网页，本字段放置该网页的地址）
	 * 
	 * @return value
	 */
	public String getURL() {
		return URL;
	}

	/**
	 * Set the 'URL' element value. 错误描述相关URL（在某些情景下，可以将错误描述发布成网页，本字段放置该网页的地址）
	 * 
	 * @param URL
	 */
	public void setURL(String URL) {
		this.URL = URL;
	}

	public String toJsonString() {
		StringBuffer sb = new StringBuffer();
		sb.append("{\"code\":\"").append(code).append("\",");
		sb.append("\"timestamp\":").append(timestamp.getTime()).append(",");
		sb.append("\"detail\":\"").append(detail).append("\"}");
		return sb.toString();
	}
}
